#ifndef BACKPACK_GAMENODE_H_
#define BACKPACK_GAMENODE_H_
#pragma once

#include "HotSpotVariant.hpp"

#include <string>
#include <algorithm>
#include <list>

#include <boost/utility.hpp>

namespace backpack {


class GameNode : boost::noncopyable {
public:
  static const GameNode c_null;

  GameNode(
    std::string const& name,
    std::string const& description = "",
    std::string const& locationString = "")
    : m_strName(name), m_strLocation(locationString),
    m_strDescription(description) {
  }

  void addHotSpot(HotSpotVariant hotspot) {
    m_listHotSpots.push_back(hotspot);
  }

  std::string const& getName() const {
    return m_strName;
  }
  std::string const& getDescription() const {
    return m_strDescription;
  }
  std::string const& getLocationString() const {
    return m_strLocation;
  }

  template <class Visitor>
  void acceptHotspotVisitor(Visitor const& visitor) const {
    auto hotSpotVisitor = makeHotSpotVisitor(visitor);
    std::for_each(
      m_listHotSpots.begin(),
      m_listHotSpots.end(),
      boost::apply_visitor(hotSpotVisitor)
      );
  }

  bool operator==(GameNode const& rhs) const {
    return m_strName == rhs.m_strName;
  }
  bool operator!=(GameNode const& rhs) const {
    return m_strName != rhs.m_strName;
  }

private:
  std::string const m_strName;
  std::string const m_strDescription;
  std::string const m_strLocation;
  std::list<HotSpotVariant> m_listHotSpots;
};


} // namespace backpack

#endif // BACKPACK_GAMENODE_H_

